# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgbase=libxml++-5.0
pkgname=(libxml++-5.0 libxml++-5.0-docs)
pkgver=5.0.3
pkgrel=1
pkgdesc="C++ bindings to libxml2"
url="https://libxmlplusplus.github.io/libxmlplusplus/"
arch=(loong64 x86_64)
license=(LGPL)
depends=(
  gcc-libs
  libxml2
)
makedepends=(
  git
  meson
  mm-common
)
options=(!emptydirs)
_commit=81da7ce28c1aa71a18d5540b9d0d8cf2baba93b0  # tags/5.0.3^0
source=("git+https://github.com/libxmlplusplus/libxmlplusplus#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd libxmlplusplus
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd libxmlplusplus
}

build() {
  arch-meson libxmlplusplus build -D maintainer-mode=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_libxml++-5.0() {
  provides=(libxml++-5.0.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_libxml++-5.0-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}

# vim:set sw=2 sts=-1 et:
